<template>
    <page-layout>
        <template v-slot:header>
            <el-button @click="backEvt" size="mini" >返回</el-button>
        </template>
        <el-form :model="shopInfo" label-width="100px">
            <el-form-item label="商铺编码：" >
                <el-input v-model="shopInfo.shop_id" readonly></el-input>
            </el-form-item>
            <el-form-item label="商铺名字：">
                <el-input v-model="shopInfo.shop_name" readonly></el-input>
            </el-form-item>
            <el-form-item label="店长：">
                <el-input v-model="shopInfo.manager" readonly></el-input>
            </el-form-item>
            <el-form-item label="店员：">
                <el-input v-model="shopInfo.clark" readonly></el-input>
            </el-form-item>
            <el-form-item label="商铺经度：">
                <el-input v-model="shopInfo.lat" readonly></el-input>
            </el-form-item>
            <el-form-item label="商铺纬度：">
                <el-input v-model="shopInfo.lng" readonly></el-input>
            </el-form-item>
            <el-form-item label="地址：">
                <el-input v-model="shopInfo.address" readonly></el-input>
            </el-form-item>
            <el-form-item label="备注：">
                <el-input v-model="shopInfo.remark" readonly></el-input>
            </el-form-item>
        </el-form>
    </page-layout>
</template>
<script>
import store from '@/store'
    export default{
        data(){
            return{
                shopInfo:{},
                shopId:'',
                shopList:[],
            }
        },
        methods:{
            backEvt(){
                sessionStorage.removeItem('detail')
                this.$router.go(-1)
            },
        },
        async mounted(){
            // this.shopId = window.location.search.split('=')[1]
            this.shopId = sessionStorage.getItem('detail')
            if(!!this.shopId){
                this.shopList = store.getters['common/shopList']
                let shopTarget = this.shopList.find(it =>{
                    return it.shop_id === this.shopId
                })
                this.shopInfo = shopTarget
            }
            console.log(this.$route.path)           
        },
        beforeRouteLeave(to,from,next){
            sessionStorage.removeItem('detail')
            next()
        }
    }
</script>